package com.utils;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.alibaba.fastjson.JSON;

/**
 * 构建tree
 * @author 池豪杰
 * @date 2019年6月3日
 *
 */
public class SimpleTree<T> implements Serializable {
    /**
	*/
	private static final long serialVersionUID = 8252778413727093519L;
	/**
     * 节点ID
     */
    private String i;
    /**
     * 显示节点文本
     */
    private String t;
    /**
     * 节点的子节点
     */
    private List<SimpleTree<T>> c = new ArrayList<SimpleTree<T>>();

    /**
     * 父ID
     */
    private String p;

    

	public SimpleTree(String id, String text, String state, boolean checked,
            Map<String, Object> attributes, List<SimpleTree<T>> children,
            boolean isParent, boolean isChildren, String parentID) {
        super();
        this.i = id;
        this.t = text;
        this.c = children;
        this.p = parentID;
    }

    public SimpleTree() {
        super();
    }

    public SimpleTree(String id, String text, String parentId) {
		super();
		this.i = id;
		this.t = text;
		this.p = parentId;
	}
    
    public SimpleTree(Long id, String text, Long parentId) {
		super();
		this.i = String.valueOf(id);
		this.t = text;
		this.p = String.valueOf(parentId);
	}
    

	public String getI() {
		return i;
	}

	public void setI(String i) {
		this.i = i;
	}

	public String getT() {
		return t;
	}

	public void setT(String t) {
		this.t = t;
	}

	public List<SimpleTree<T>> getC() {
		return c;
	}

	public void setC(List<SimpleTree<T>> c) {
		this.c = c;
	}

	public String getP() {
		return p;
	}

	public void setP(String p) {
		this.p = p;
	}

	@Override
    public String toString() {
        
        return JSON.toJSONString(this);
    }
	
	
	
}